package com.tac.controller;

import com.tac.common.result.Result;
import com.tac.pojo.EnterpriseInfo;
import com.tac.service.EnterpriseInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/enterpriseInfo")
@CrossOrigin
@Api(tags = "企业信息接口")
public class EnterpriseInfoController {

    @Autowired
    private EnterpriseInfoService enterpriseInfoService;

    @GetMapping("/getByTargetId")
    @ApiOperation("根据标的id查询企业信息")
    public Result<EnterpriseInfo> getByTargetId(Integer targetId){
        return enterpriseInfoService.getByTargetId(targetId);
    }

    @PostMapping("/save")
    @ApiOperation("企业信息添加")
    public Result save(@RequestBody EnterpriseInfo enterpriseInfo){
        return enterpriseInfoService.save(enterpriseInfo);
    }

    @PutMapping("/update")
    @ApiOperation("企业信息修改")
    public Result update(@RequestBody EnterpriseInfo enterpriseInfo){
        return enterpriseInfoService.update(enterpriseInfo);
    }
}
